2026-09-20 · a-plus, comptia, class-notes
DNS (Domain Name System) is one of the most critical services on any network. It lets us provide IP addresses when all we remember is a fully qualified domain name (FQDN).
Class notes · Professor Messer, CompTIA A+ 220-1201 Core 1 · Objective 2.4
Quick reference: the short version of this lesson is the DNS cheat sheet, part of Section 2.
By the end of these notes you should be able to:
DNS (Domain Name System) is one of the most critical services on any network. It lets us provide IP addresses when all we remember is a fully qualified domain name (FQDN).
Worked example — the basic lookup. You type www.professormesser.com into a browser:
DNS does far more than this basic lookup too, as this lesson explores.
DNS is a distributed database: it's scattered across the internet, with different portions held on different servers, on different networks, around the world. Together, this hierarchy can resolve the IP address for any fully qualified domain name on the internet.
At the top of the hierarchy sit 13 root server clusters. Each "cluster" is far more than one machine — in reality, over 1,000 servers make up that root server system between them. The root servers direct queries down to the servers responsible for top-level domains.
Type
Examples
Generic top-level domains (gTLDs)
.com, .org, .net
Country-code top-level domains
.us (United States), .ca (Canada), .uk (United Kingdom)
There are roughly 275 country codes in use for TLDs.
root
|
\+--------\+--------\+
.com .uk (and other TLDs)
|
professormesser
|
\+-------------\+-------------\+
www mail
| |
(the web server) (the mail server)
You can add further layers too, e.g.: katie.east.professormesser.com judy.west.professormesser.comEach layer — TLD, domain, subdomain, host — lets an organisation structure its DNS in a way that makes sense for it, while remaining accessible to anyone in the world.
dig is a common DNS query tool on Linux and macOS (a version is also installable on some Windows systems).
dig www.professormesser.comThe output shows:
Worked example — three answers. Querying www.professormesser.com returns three separate IP addresses. This is deliberate: multiple redundant web servers exist, so if one address becomes unavailable, the others can still be used.
nslookup is the equivalent tool built into Windows:
nslookup professormesser.comQuerying the same domain with nslookup returns the same three IP addresses.
Every answer a DNS server gives comes from an entry in its database, called a resource record (RR). Resource records can hold IP addresses, certificate information, email routing details, host aliases and more.
Caution: DNS configuration is not something to experiment with casually. A single mistake in a DNS server's records can make one or more of your services suddenly unreachable from the rest of the internet. Always keep a backup, and know how to revert quickly if a change causes a problem.
Two ways to edit records:
A DNS server's configuration commonly includes an SOA record at the top (defining authority for the zone), along with MX, A and CNAME records, among others — each covered in the sections below.
Record
IP version
Also known as
A
IPv4
Address record
AAAA
IPv6
"Quad A" record
Both define the IP address for a hostname.
Worked example — reading an A record.
www.professormesser.com IN A 162.159.246.164- IN — internet.
Worked example — adding one through a web front end. Fields typically requested:
Field
Example
Host name
www
IP address
162.159.246.164
TTL (time to live)
15 minutes
TTL is how long a resolver (and the requesting user's device) will remember that answer before asking again. After 15 minutes here, the record times out, and the next request re-queries the DNS server. This is deliberate: it lets an administrator change the IP address at any time, knowing the change will be visible everywhere within, at most, one TTL period.
AAAA records are added the same way — host name, IPv6 address, and a TTL.
Sometimes one physical server plays several roles: a web server, a DNS server, an NTP server and a mail server all at once. Instead of giving every service the same name, you can use canonical names (CNAMEs) that all point back to one underlying host.
Worked example:
mail.example.com (the real server, with its own A record) chat.example.com CNAME → mail.example.com ftp.example.com CNAME → mail.example.com www.example.com CNAME → mail.example.comEvery request for chat., ftp. or www.example.com really connects to mail.example.com.
Why this matters for administration: if the underlying server's IP address ever changes, you only update the one A record (mail.example.com) — every CNAME pointing to it automatically follows, with no changes needed to the CNAME records themselves.
MX (Mail Exchanger) records are among the most critical on any domain — they make sending and receiving email possible.
Structure:
example.com IN MX mail.example.com- IN — internet.
Worked example — sending mail to james@professormesser.com:
A web-based DNS front end might show:
Field
Example
Host
Target
mail.hover.com.cust.hostedemail.com
This routes mail for that domain to a third-party hosted email provider, rather than a self-managed server.
Every domain has its own MX records, configured (via a raw file or a web front end) with a record type, host name, target name, and a TTL — just like the other record types.
TXT (text) records are human-readable entries anyone can query from a DNS server. They're used for:
Worked example — viewing TXT records:
dig professormesser.com TXTor, on Windows:
nslookup -type=txt google.comQuerying professormesser.com this way might show, for example, one TXT record used for a service verification (such as a "stripe verification" entry), and another used as an SPF record.
DKIM adds a digital signature to outgoing email, so recipients can confirm a message genuinely came from your domain.
Where
What's stored
DNS TXT record
The public key — you'll see v=DKIM in the record
Your email server
The matching private key
How it works:
Adding a DKIM record through a web front end:
Field
Example
Host name
Usually provided by your email service
Text content
The public key
TTL
e.g. 15 minutes
Organisations often send email from several different sources: an internal mail server, plus perhaps a third-party bulk-mail provider. SPF lets you publish which servers are allowed to send mail on your behalf.
How it works:
Adding an SPF record:
Field
Example
Record type
TXT
Host name
All hosts, shown as @
Content
The list of approved outgoing mail servers
SPF and DKIM checks can each pass or fail. DMARC tells receiving mail servers what to do when they fail, on your domain's behalf:
Policy option
Effect on a failing message
Accept
Deliver it anyway
Quarantine
Send it to spam/quarantine
Reject
Drop it entirely
Reporting: a DMARC record can also include an email address, so receiving servers send back a report of how messages from your domain were handled. This lets you build a picture of how many messages got through, and how many were flagged.
Worked example — reading a DMARC record:
A DMARC TXT record specifies that messages failing validation should be put into quarantine (spam), and that reports of that disposition should be sent to a specified reporting email address for later analysis.
Sender publishes: SPF -> which servers may send mail for this domain DKIM -> a public key to verify message signatures DMARC -> what to do if SPF or DKIM checks fail, and where to report it
Receiver, for each incoming message:
Term
Definition
DNS
Domain Name System — resolves domain names to IP addresses
FQDN
Fully qualified domain name
Distributed database
A database spread across many servers and networks
Root server
A top-level DNS server directing queries to TLD servers
TLD
Top-level domain, e.g. .com or a country code like .uk
gTLD
Generic top-level domain
ccTLD
Country-code top-level domain
dig
A DNS query tool for Linux/macOS
nslookup
A DNS query tool built into Windows
Resource record (RR)
An entry in a DNS server's database
A record
Maps a hostname to an IPv4 address
AAAA record
Maps a hostname to an IPv6 address
TTL
Time to live — how long a DNS answer is cached
CNAME
An alias record pointing one name to another
MX record
Names a domain's mail server(s)
TXT record
A human-readable text entry in DNS
SOA record
Defines authority and settings for a DNS zone
DKIM
DomainKeys Identified Mail — digitally signs outgoing email
Public / private key
The key pair DKIM uses to sign and verify mail
SPF
Sender Policy Framework — lists a domain's authorised mail servers
DMARC
Domain-based Message Authentication, Reporting and Conformance
Quarantine
Placing a message in spam/junk rather than delivering or rejecting it